<template>
  <v-table
    :tableConfig="tableConfig"
    :tableData="tableData"
    :hasEdit="false"
    :right="false"
    :searchFlag="false"
    :pageFlag="false"
    @getTableData="getTableData"
    @selectData="setSelectData"
    ref="table"
  ></v-table>
</template>

<script>
import table from 'commons/Table'
import baseMixin from "@/mixins/BaseMixin";

export default {
  name: "Table",
  mixins: [baseMixin],
  props: {
    inputData: {
      type: Object
    }
  },
  data () {
    return {
      tableConfig: [
        {
          label: this.$t('ex.putawayzone'),
          prop: "putawayzone",
          input: "input",
        },
        {
          label: this.$t('config.loc'),
          prop: "loc",
          input: "input"
        },
        {
          label: this.$t('work.qty'),
          prop: "qty",
          input: "input",
        },
        {
          label: this.$t('config.shipper'),
          prop: "storerkey",
          input: "input"
        },
        {
          label: this.$t('config.sku'),
          prop: "sku",
          input: "input"
        },
        {
          label: this.$t('common.desc'),
          prop: "descr",
          input: "input"
        },
      ],
      tableData: [],
      searhData: {}
    }
  },
  methods: {
    //获取table数据
    getTableData (showKw, dataId) {
      this.$api.post(`/PartsLibraryScreen/showKw/${showKw}/${dataId}`).then(res => {
        
          this.tableData = res.bean;
          if (this.tableData.length == 0) {
            this.$message.warning("查询无数据!")
          }
        
      })
    },
    initTable (dataId) {
      this.$api.get(`/PartsLibraryScreen/getKqsdList/${dataId}`).then(res => {
        
          this.tableData = res.data.list;
          this.$refs.table.delSelectData(this.tableData);
        
      })
    },
    //选中的数据
    setSelectData (data) {
      this.$parent.setSelectData(data)
    },
  },
  watch: {

  },
  mounted () {

  },
  components: {
    'v-table': table
  }
}
</script>

<style scoped>
</style>